#include "stdio.h"
#include <iostream>
using namespace std;

void bubblesort1A(int A[], int n){
	bool sorted = false;
	while(!sorted){
		sorted = true;
		for(int i = 1; i < n; i++){
			if(A[i-1] > A[i]){
				swap(A[i], A[i-1]);
				sorted = false;
			}
		}
		n--;
	}
}

int main()
{
	int numList[] = {3,4,1,2,9,8,7};
	bubblesort1A(numList, 7);
	for(int i = 0; i < 7; i++){
		cout<<numList[i]<<endl;
	}
	return 1;
}